package com.lizhi.yun.db.sfrobot.entity;

import com.lizhi.mybatis.boot.Description;
import com.lizhi.yun.db.sfrobot.common.IllnessSideType;
import com.lizhi.yun.db.sfrobot.common.RobotType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

import javax.persistence.*;

/**
 * 处方执行记录
 */
@Data
@ToString
@Entity
@Table(name = "his_center_training_record")
@Description("训练记录")
public class TrainingRecord extends AbstractHisEntity {

    @Id
    @Column(length = 30)
    @Description("lid")
    public String lid;

    @Description("记录id")
    public String id;

    /**
     * 患者id
     */
    @Column
    @Description("患者id")
    public String patientId;

    @Column
    @Description("患者姓名")
    public String patientName;

    @Column
    @Description("患者编号")
    public String patientNo;

    @Column
    @Description("患者手机号")
    public  String patientPhone;

    /**
     * 医师id
     */
    @Column
    @Description("医师id")
    public String doctorId;

    /**
     * 治疗师账号
     */
    @Column(length = 20)
    @Description("医师账号")
    public String doctorAccount;

    /**
     * 治疗师姓名
     */
    @Column(length = 20)
    @Description("医师姓名")
    public String doctorName;

    /**
     * 治疗师id
     */
    @Column
    @Description("治疗师id")
    public Long therapistId;

    /**
     * 治疗师账号
     */
    @Column(length = 20)
    @Description("治疗师账号")
    public String therapistAccount;

    /**
     * 治疗师姓名
     */
    @Column(length = 20)
    @Description("治疗师姓名")
    public String therapistName;

    /**
     * 预约id
     */
    @Column
    @Description("预约id")
    public String appointmentId;

    /**
     * 处方id
     */
    @Column
    @Description("处方id")
    public String prescriptionId;

    /**
     * 总时长(s)
     */
    @Column
    @Description("训练时长")
    public Integer duration;

    /**
     * 动作数量
     */
    @Column
    @Description("动作数量")
    public Integer actionCount;

    /**
     * 取消执行次数
     */
    @Column
    @Description("已取消次数")
    public Integer canceledCount;

    /**
     * 已经执行次数
     */
    @Column
    @Description("已执行次数")
    public Integer executedCount;

    /**
     * 总执行次数
     */
    @Column
    @Description("总执行次数")
    public Integer plannedCount;

    /**
     * 机器人型号id
     */
    @Column
    @Description("设备型号id")
    public String robotModelId;

    /**
     * 机器人型号编号
     */
    @Column
    @Description("设备型号编号")
    public String robotModelNo;

    /**
     * 机器人型号
     */
    @Column
    @Description("设备型号名称")
    public String robotModelText;

    /**
     * 机器人id
     */
    @Column
    @Description("设备id")
    public String robotDeviceId;

    /**
     * 机器人设备编号
     */
    @Column
    @Description("设备编号")
    public String robotDeviceNo;

    /**
     * 机器人设备名称
     */
    @Column
    @Description("设备名称")
    public String robotDeviceText;

    @Column
    @Description("上下肢类型")
    public Integer robotType;

    @Description("上下肢机器人类型")
    @Transient
    public String robotTypeText;

    @Column
    @Description("患侧")
    public Integer illnessSide;

    @Description("患侧")
    @Transient
    public String illnessSideText;

    @Column(length = 20)
    @Description("创建时间")
    public String createTime;

    /*云管需要的数据*/
    @ApiModelProperty(value = "医院ID")
    private String hospitalId;

    @ApiModelProperty(value = "系统ID")
    private String hospitalSystemId;

    public String getRobotTypeText() {
        if (RobotType.UpperLimb.getEnValue().equals(this.robotType)){
            this.robotTypeText = RobotType.UpperLimb.getEnName();
        } else if (RobotType.LowerLimb.getEnValue().equals(this.robotType)){
            this.robotTypeText = RobotType.LowerLimb.getEnName();
        }
        return robotTypeText;
    }

    public String getIllnessSideText() {
        if (IllnessSideType.SideBoth.getEnValue().equals(this.illnessSide)){
            this.illnessSideText = IllnessSideType.SideBoth.getEnName();
        } else if (IllnessSideType.SideLeft.getEnValue().equals(this.illnessSide)){
            this.illnessSideText = IllnessSideType.SideLeft.getEnName();
        } else if (IllnessSideType.SideRight.getEnValue().equals(this.illnessSide)){
            this.illnessSideText = IllnessSideType.SideRight.getEnName();
        }
        return illnessSideText;
    }
}